def doSomeIf():
    cls = 'human'
    sex = 'female'
    age = 20
    # 条件都要满足
    if cls == 'human' and sex == 'female' and age > 18 and age < 26:
        print('开始表白..... 以下省略一万字')
        is_success = input('女孩输入我愿意')
        # 嵌套里面当然也是可以用if 语法 1 2 3
        if is_success == '我愿意':
            print('在一起')
        elif is_success == 'xxx':
            print('xxxxx')
        else:
            print('我逗你玩呢....')
    else:
        print('姐姐好')


# doSomeIf()


def andOrNot():
    a = False
    b = True
    c = False
    d = False
    print(a or b and c or d)
    print(not a or b and c or d)
    print(a or not b and c or d)
    d = True
    print(a or b and c or d)
    print(1 > 3 or 1 == 1 or 'x' == 'y' or 2 > 4)
    print(not 1 > 3)


# andOrNot()


def doSomeWhile():
    num = 10
    while num > 0:
        if num == 7:
            num -= 1
            continue
        elif num == 3:
            break
        print(num)
        num -= 1


# doSomeWhile()


def doSomeFor():
    names = ['dahai', 'xialuo', 'guan', 'xishi', 'guan', 'xishi']
    # for name in names:
    #     print(name)
    # for e in range(len(names)):
    #     print(e)
    # list与range的区别在于list需要将元素加载到内存，而range是一个迭代器，一次生成一个元素
    # list相当于一个装满鸡蛋的筐，range相当于母鸡，一次下一个蛋
    # for i in [1, 2, 3, 4, 6, 7, 8]:
    #     print(i)
    # for i in range(1, 8):
    #     print(i)

    # kv = {'name1': 'dahai', 'name2': 'xialuo', 'name3': 'xishi'}
    # # 遍历key
    # for e in kv:
    #     print(e)
    # for e in kv.keys():
    #     print(e)
    # # 遍历value
    # for val in kv.values():
    #     print(val)
    # # 遍历item
    # for item in kv.items():
    #     print(item)

    # 集合遍历不能保证顺序
    s = set(names)
    for e in s:
        print(e)


doSomeFor()
